n = int(input())
s = list(input())

ans = 0
fg = True

##for i in range(n - 1):
##    if s[i] == 'V':
##        if s[i + 1] == 'K':
##            ans += 1
##        elif fg and ( i + 2 >= n or s[i + 2] != 'K' ):
##            s[i + 1] = 'K'
##            ans += 1
##            fg ^= 1

for i in range(n + 1):

    now = 0
    
    if i < n:
        if s[i] == 'V':
            s[i] = 'K'
        else:
            s[i] = 'V'

    for j in range(n - 1):
        if s[j] == 'V' and s[j + 1] == 'K':
            now += 1

    if i < n:
        if s[i] == 'K':
            s[i] = 'V'
        else:
            s[i] = 'K'

    ans = max(ans, now)
    
print(ans)
